package org.tech4j.edi.persistence.api.query;

import org.tech4j.edi.common.enums.RetryStatusEnum;

import java.time.LocalDateTime;
import java.util.Map;

/**
 * @program: tech4j
 * @description:
 * @author: YuKai Fan
 * @create: 2025/3/7 11:45
 **/
public class RetryCountQuery {

    /**
     * id
     */
    private String id;

    /**
     * 业务类型
     */
    private String bizType;

    /**
     * 状态
     */
    private RetryStatusEnum retryStatus;

    /**
     * 业务号
     */
    private String bizNo;

    /**
     * 开始创建时间
     */
    private LocalDateTime createTimeStart;

    /**
     * 结束创建时间
     */
    private LocalDateTime createTimeEnd;

    /**
     * 结束修改时间
     */
    private LocalDateTime modifyTimeEnd;

    /**
     * 扩展字段
     */
    private Map<String, String> extraField;

    /**
     * 分片key
     */
    private String shardingKey;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getBizType() {
        return bizType;
    }

    public void setBizType(String bizType) {
        this.bizType = bizType;
    }

    public RetryStatusEnum getRetryStatus() {
        return retryStatus;
    }

    public void setRetryStatus(RetryStatusEnum retryStatus) {
        this.retryStatus = retryStatus;
    }

    public String getBizNo() {
        return bizNo;
    }

    public void setBizNo(String bizNo) {
        this.bizNo = bizNo;
    }

    public LocalDateTime getCreateTimeStart() {
        return createTimeStart;
    }

    public void setCreateTimeStart(LocalDateTime createTimeStart) {
        this.createTimeStart = createTimeStart;
    }

    public LocalDateTime getCreateTimeEnd() {
        return createTimeEnd;
    }

    public void setCreateTimeEnd(LocalDateTime createTimeEnd) {
        this.createTimeEnd = createTimeEnd;
    }

    public LocalDateTime getModifyTimeEnd() {
        return modifyTimeEnd;
    }

    public void setModifyTimeEnd(LocalDateTime modifyTimeEnd) {
        this.modifyTimeEnd = modifyTimeEnd;
    }

    public Map<String, String> getExtraField() {
        return extraField;
    }

    public void setExtraField(Map<String, String> extraField) {
        this.extraField = extraField;
    }

    public void setShardingKey(String shardingKey) {
        this.shardingKey = shardingKey;
    }
    public String getShardingKey() {
        return shardingKey;
    }

    public static final class Builder {
        private String id;
        private String bizType;
        private RetryStatusEnum retryStatus;
        private String bizNo;
        private LocalDateTime createTimeStart;
        private LocalDateTime createTimeEnd;
        private LocalDateTime modifyTimeEnd;
        private Map<String, String> extraField;
        private String shardingKey;

        private Builder() {
        }

        public static Builder builder() {
            return new Builder();
        }

        public Builder id(String id) {
            this.id = id;
            return this;
        }

        public Builder bizType(String bizType) {
            this.bizType = bizType;
            return this;
        }

        public Builder retryStatus(RetryStatusEnum retryStatus) {
            this.retryStatus = retryStatus;
            return this;
        }

        public Builder bizNo(String bizNo) {
            this.bizNo = bizNo;
            return this;
        }

        public Builder createTimeStart(LocalDateTime createTimeStart) {
            this.createTimeStart = createTimeStart;
            return this;
        }

        public Builder createTimeEnd(LocalDateTime createTimeEnd) {
            this.createTimeEnd = createTimeEnd;
            return this;
        }

        public Builder modifyTimeEnd(LocalDateTime modifyTimeEnd) {
            this.modifyTimeEnd = modifyTimeEnd;
            return this;
        }

        public Builder extraField(Map<String, String> extraField) {
            this.extraField = extraField;
            return this;
        }

        public Builder shardingKey(String shardingKey) {
            this.shardingKey = shardingKey;
            return this;
        }

        public RetryCountQuery build() {
            RetryCountQuery retryCountQuery = new RetryCountQuery();
            retryCountQuery.setId(id);
            retryCountQuery.setBizType(bizType);
            retryCountQuery.setRetryStatus(retryStatus);
            retryCountQuery.setBizNo(bizNo);
            retryCountQuery.setCreateTimeStart(createTimeStart);
            retryCountQuery.setCreateTimeEnd(createTimeEnd);
            retryCountQuery.setModifyTimeEnd(modifyTimeEnd);
            retryCountQuery.setExtraField(extraField);
            retryCountQuery.setShardingKey(shardingKey);
            return retryCountQuery;
        }
    }
}
